<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.kamus.model.FileDb"%>
<%@page import="com.kamus.manager.FileDbMgr"%>
<%@page import="java.util.Iterator"%>
<%@page import="com.kamus.Constants" %>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <body>
        <form action="FiledbServlet" method="POST">
            <h1>File Database</h1>
            <table border="0" width="100%">
                <tr>
                    <td colspan="6" align="right">
                        <input type="submit"  name="<%=Constants.ACTION%>" value="<%=Constants.DELETE%>"/>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td>ID</td>
                    <td>Nama</td>
                    <td>Tanggal</td>
                    <td>Type</td>
                    <td>Used</td>
                </tr>
                <tr>
                    <td colspan="6"><b>Database Gaul-Indonesia</b></td>
                </tr>
                <%
                            List<FileDb> list = new ArrayList<FileDb>();
                            list = FileDbMgr.getInstance().getFiles(FileDbMgr.TYPE_GI, "TANGGAL");
                            FileDb fileDb = null;
                            String warna = "";
                            int i = 0;
                            for (Iterator<FileDb> it = list.iterator(); it.hasNext();) {
                                fileDb = it.next();
                                if (i % 2 == 0) {
                                    warna = "#FFFFFF";
                                } else {
                                    warna = "#A0CFEC";
                                }
                %>
                <tr>
                    <td><input type="checkbox" name="item" value="<%=fileDb.getId()%>"/></td>
                    <td bgcolor="<%=warna%>"><a href="FiledbForm.jsp?type=gi&id=<%=fileDb.getId()%>"><%=fileDb.getId()%></a></td>
                    <td bgcolor="<%=warna%>"><%=fileDb.getNama()%></td>
                    <td bgcolor="<%=warna%>"><%=fileDb.getTanggal()%></td>
                    <td bgcolor="<%=warna%>"><%=fileDb.getType()%></td>
                    <td bgcolor="<%=warna%>"><input type="radio" name="used_gi" checked=""/></td>
                </tr>
                <%
                                i++;
                            }
                %>
                <tr>
                    <td colspan="6">-</td>
                </tr>
                <tr>
                    <td colspan="6"><b>Database Gaul-Indonesia</b></td>
                </tr>
                <%
                            list = FileDbMgr.getInstance().getFiles(FileDbMgr.TYPE_IG, "TANGGAL");
                            i = 0;
                            for (Iterator<FileDb> it = list.iterator(); it.hasNext();) {
                                fileDb = it.next();
                                if (i % 2 == 0) {
                                    warna = "#FFFFFF";
                                } else {
                                    warna = "#A0CFEC";
                                }
                %>
                <tr>
                    <td><input type="checkbox" name="item" value="<%=fileDb.getId()%>"/></td>
                    <td bgcolor="<%=warna%>"><a href="FiledbForm.jsp?type=gi&id=<%=fileDb.getId()%>"><%=fileDb.getId()%></a></td>
                    <td bgcolor="<%=warna%>"><%=fileDb.getNama()%></td>
                    <td bgcolor="<%=warna%>"><%=fileDb.getTanggal()%></td>
                    <td bgcolor="<%=warna%>"><%=fileDb.getType()%></td>
                    <td bgcolor="<%=warna%>"><input type="radio" name="used_ig" checked=""/></td>
                </tr>
                <%
                                i++;
                            }
                %>
                <tr>
                    <td colspan="6" align="right">
                        <input type="submit"  name="<%=Constants.ACTION%>" value="<%=Constants.DELETE%>"/>
                    </td>
                </tr>
            </table>
        </form>

    </body>
</html>
